﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using WF_TheTourManagement.EntityClass;
using System.Data.SqlClient;
using System.Data;

namespace WF_TheTourManagement
{
    class Tour
    {
        int tourId;
        string tourName;
        int tourType;
        long currentPrize;
        List<int> locations;

        public Tour() { }
        public Tour(Tour _tour) 
        {
            this.tourId = _tour.tourId;
            this.tourName = _tour.tourName;
            this.tourType = _tour.tourType;
            this.currentPrize = _tour.currentPrize;
            this.locations = _tour.locations;
        }
        public Tour(string name) 
        {
            this.tourName = name;
        }

        public void saveTour()
        {           
            SqlCommand sqlCmd = new SqlCommand();
            sqlCmd.Connection = DataConnection.Connection();
            sqlCmd.CommandType = CommandType.Text;
            sqlCmd.CommandText = "insert into Tours (TourName) values ('"+ this.tourName +"')";
            sqlCmd.ExecuteNonQuery();

        }

        public DataTable allTours()
        {
            DataTable dt = new DataTable();

            SqlCommand sqlCmd = new SqlCommand();
            sqlCmd.Connection = DataConnection.Connection();

            sqlCmd.CommandType = CommandType.StoredProcedure;
            sqlCmd.CommandText = "getAllTours";
            SqlDataReader daReader = sqlCmd.ExecuteReader();
            dt.Load(daReader);

            return dt;
        }


    }
}
